<?php
ob_start();
echo $this->renderPartial('_shoping_cart_email_template', array('orderId' => $orderId, 'totalCost' => $totalCost));
$mailmodel = EmailTemplate::model()->findByPk(Message::AFTER_PURCHAGE_ORDER);
$content = ob_get_clean();
$mailbody = array('value' => $mailmodel->body, 'type' => 'html');
$subject = $mailmodel->subject;
$userName = Users::model()->findByPk(getLoginUserId());
$userName = $userName->username;
$arrayFind = array('[username]', '[order_details]');
$arrayReplace = array($userName, $content);
$mailbody = str_replace($arrayFind, $arrayReplace, $mailbody);
$mailtemp = Template::model()->findByPk($mailmodel->template_id);
$subject = $mailmodel->subject;
$body = $this->renderPartial('/mails/' . $mailtemp->filename, array('mailbody' => $mailbody['value']), true, false);

try {
    SkillSendMail::SendMail($userName, $subject, $body);
    ShoppingCartByUser::model()->deleteAll('user_id=' . getLoginUserId());
    Yii::app()->shoppingCart->clear();
    Coupons::unsetSessionShopingcart();
} catch (Exception $e) {
    echo $e;
    exit;
}
?>
<div class="container">
    <div class="row">
        <div class="span12">	            	
            <ul class="breadcrumb">
                <li class="previous"><a href="#">Home /</a></li>                
                <li class="disable"><a href="#">Payment</a></li>
            </ul>  

            <div class="common">
                <div class="whiteBg greenBor padding20px">
                    <h5 class="fnt-size20">Payment</h5>
                </div>
            </div>
            <div class="arrowHeading addmarginB10">
                <p class="">Review Your Order</p><img src="<?php echo ThemePath(); ?>/images/arrow-right.png">
            </div>

            <!--Shopping Cart Start-->
            <div class="cartBlock">
                <div class="tr">
                    <div class="col col4">
                        <div class="padding20px">
                            Test
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>	
            </div>	 
        </div>
    </div>
</div>
<script>
    $(document).ready(function() {
        setTimeout(window.location.assign("<?php echo Yii::app()->createUrl("/users/learnuser/"); ?>"), 100000);

    });
</script>
